<%= error_messages_for :user %>

<% form_for(:user, :url => @user.new_record? ? users_path : user_path(@user), :html => { :method => @user.new_record? ? :post : :put }) do |f| %>
  <p>
    <label for="user_name">Name</label>
    <%= f.text_field :name %>
  </p>

  <p>
    <%= submit_tag @user.new_record? ? "Create" : 'Update' %>
  </p>
<% end %>
